package com.qcby.shujia.demo.service.impl;

import com.qcby.shujia.demo.entity.Tright;
import com.qcby.shujia.demo.mapper.TrightMapper;
import com.qcby.shujia.demo.service.TrightService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @className: TrightServiceImpl
 * @description: TODO 类描述
 * @author: whz
 * @date: 2021/9/20
 **/
@Service
public class TrightServiceImpl implements TrightService {
    @Autowired
    private TrightMapper trightMapper;
    @Override
    public int insert(Tright tright) {
        int i=trightMapper.insert(tright);
        return i;
    }

    @Override
    public int delete(Integer id) {
        int i=trightMapper.deleteById(id);
        trightMapper.deleterr(id);
        return i;
    }

    @Override
    public int deletedisp(int[] ids) {
        int flag=1;
        for (int i = 0; i <ids.length ; i++) {
            int i1 = delete(ids[i]);
            if(i1==0){
                flag=0;
            }
        }
        return flag;
    }

    @Override
    public List<Tright> selectAll() {
        List<Tright> li=trightMapper.selectAll();
        return li;
    }

    @Override
    public int update(Tright tright) {
        int i=trightMapper.update(tright);
        return i;
    }
}
